<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/HomeTemplate.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                >
    <ui:define name="body">
        
        <div class="main-container" >
        
        <h:form>
            <p:panelGrid columns="2">
                <p:column>
        <p:panelMenu style="width:200px; text-align: left">
            <p:submenu label="Dealers" >
                <p:menuitem value="Dealer Managment" icon="ui-icon-bullet" url="AdminParametrics.xhtml" />
            
        </p:submenu>
        <p:submenu label="Order">
            <p:menuitem value="Brand Managment "  icon="ui-icon-bullet" url="AdminParametricBrand.xhtml"/>
            <p:menuitem value="Product Type Managment "  icon="ui-icon-bullet" url="AdminParametricProduct.xhtml" />
            <p:menuitem value="Category Managment"   icon="ui-icon-bullet" url="AdminParametricCategory.xhtml"/>
            <p:menuitem value="Catalog Managment"  icon="ui-icon-bullet" url="AdminParametricCatalog.xhtml"/>
            <p:menuitem value="Inventory Managment"  icon="ui-icon-bullet" url="AdminParametricInventory.xhtml"/>
        </p:submenu>
         <p:submenu label="Account">
            <p:menuitem value="Delete"   icon="ui-icon-bullet"/>
        </p:submenu>
        <p:submenu label="Warranty" >
            <p:submenu label="Links" icon="ui-icon-bullet">
                <p:submenu label="PrimeFaces" icon="ui-icon-bullet">
                    <p:menuitem value="Home" url="http://www.primefaces.org" icon="ui-icon-bullet" />
                </p:submenu>
            </p:submenu>
            <p:menuitem value="Mobile" icon="ui-icon-bullet" />
        </p:submenu>
        <p:submenu label="Marketing">
            <p:menuitem value="Save" icon="ui-icon-bullet" />
            
        </p:submenu>
       
        
    </p:panelMenu>
             </p:column>  
                <p:column>
                
                <p:row>
                    <p:dataTable id="brandTable" var="brand" value="#{brandBean.brands}" widgetVar="brandTable" paginator="true"
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" paginatorPosition="bottom"
                         rows="10" rowsPerPageTemplate="10,20,40" 
                         >  
                <p:column>
                    <f:facet name="header">  
                        Brand Name
                    </f:facet>  

                    <h:outputText value="#{brand.name}" />  

                </p:column> 
                 <p:column >  
                    <f:facet name="header">  
                        Description
                    </f:facet>  

                     <h:outputText value="#{brand.description}" />  

                </p:column>  
                 
                
                 <p:column filterBy="#{brand.status}">  
                    <f:facet name="header">  
                       Status
                    </f:facet>  

                    <h:outputText value="#{brand.status ? 'Active': 'Disable'}" />  

                </p:column> 

                <f:facet name="footer">  
                    In total there are #{brandBean.brands.size()} Items.  
                </f:facet>  

            </p:dataTable> 


                    <p:column id="buttons">  
                <p:commandButton  value="Add" onclick="panelwv.show();"  type="button" > </p:commandButton>   
                    </p:column>

            <p:panel id="editPanel" header="Add new Brand" widgetVar="panelwv" visible="false" style="margin-top: 10px" >  
                <h:panelGrid  >
                  
                        <p:column>
                            <h:outputText value="Brand Name: *" />   
                            <p:inputText id="nam" value="#{brandBean.brand.name}" required="true" label="Username"/>  
                        </p:column>
                        <p:column>
                            <h:outputText value="Description: *" />   
                            <p:inputText id="desc" value="#{brandBean.brand.description}" required="true" label="Password"/> 
                        </p:column>
                        
                 </h:panelGrid>
                    <p:message id="textOnlyMessage" for="nam" display="text" /> 
                    <p:message id="textOnlyMessage2" for="desc" display="text" />
                  
                    <p:commandButton value="Save" actionListener="#{brandBean.saveBrand()}" update="brandTable, textOnlyMessage, textOnlyMessage2" oncomplete="panelwv.hide();"/>

                    <p:commandButton value="Cancel" ajax="true" onclick="panelwv.hide();" immediate="true">

                    </p:commandButton> 
            </p:panel>  
    </p:row> 
                    </p:column>
</p:panelGrid>
</h:form>
  </div>
    </ui:define>
</ui:composition>

